239 research outputs found
Certified Context-Free Parsing: A formalisation of Valiant's Algorithm in Agda
Valiant (1975) has developed an algorithm for recognition of context free
languages. As of today, it remains the algorithm with the best asymptotic
complexity for this purpose. In this paper, we present an algebraic
specification, implementation, and proof of correctness of a generalisation of
Valiant's algorithm. The generalisation can be used for recognition, parsing or
generic calculation of the transitive closure of upper triangular matrices. The
proof is certified by the Agda proof assistant. The certification is
representative of state-of-the-art methods for specification and proofs in
proof assistants based on type-theory. As such, this paper can be read as a
tutorial for the Agda system
Feat: Functional Enumeration of Algebraic Types
In mathematics, an enumeration of a set S is a bijective function from (an initial segment of) the natural numbers to S. We define "functional enumerations" as efficiently computable such bijections. This paper describes a theory of functional enumeration and provides an algebra of enumerations closed under sums, products, guarded recursion and bijections. We partition each enumerated set into numbered, finite subsets.
We provide a generic enumeration such that the number of each part corresponds to the size of its values (measured in the number of constructors). We implement our ideas in a Haskell library called testing-feat, and make the source code freely available. Feat provides efficient "random access" to enumerated values. The primary application is property-based testing, where it is used to define both random sampling (for example QuickCheck generators) and exhaustive enumeration (in the style of SmallCheck). We claim that functional enumeration is the best option for automatically generating test cases from large groups of mutually recursive syntax tree types. As a case study we use Feat to test the pretty-printer of the Template Haskell library (uncovering several bugs)
Level-p-complexity of Boolean functions using Thinning, Memoization, and Polynomials
This paper describes a purely functional library for computing
level--complexity of Boolean functions, and applies it to two-level iterated
majority. Boolean functions are simply functions from bits to one bit, and
they can describe digital circuits, voting systems, etc. An example of a
Boolean function is majority, which returns the value that has majority among
the input bits for odd . The complexity of a Boolean function
measures the cost of evaluating it: how many bits of the input are needed to be
certain about the result of . There are many competing complexity measures
but we focus on level--complexity -- a function of the probability that
a bit is 1. The level--complexity is the minimum expected cost when
the input bits are independent and identically distributed with Bernoulli()
distribution. We specify the problem as choosing the minimum expected cost of
all possible decision trees -- which directly translates to a clearly correct,
but very inefficient implementation. The library uses thinning and memoization
for efficiency and type classes for separation of concerns. The complexity is
represented using polynomials, and the order relation used for thinning is
implemented using polynomial factorisation and root-counting. Finally we
compute the complexity for two-level iterated majority and improve on an
earlier result by J.~Jansson.Comment: 20 pages, 10 figure
Trust as subject content: Advancing studentsâ reasoning on democracy through displacement
Purpose: The article explores how the tension between embracing and scrutinising democracy can be productively overcome through social science teaching about democracy that focuses on trust as a subject content.
Design/methodology/approach: Empirical materials were collected through focus group interviews before and after an inquiry-based teaching segment on trust, and the materials were analysed qualitatively through three grounded themes.
Findings: It is argued that working with the displacement of subject content in inquiry-based teaching about democracy enhances the possibilities for students to deepen their knowledge about democracy, while enabling them to scrutinise the democratic system critically.
Research limitations/implications: The article reports from a small-scale study of four classes in two upper secondary schools in Sweden, and the study provides tentative observations and conclusions that should be investigated further in future research.
Practical implications: The article shows how trust as a subject content can contribute to problematising studentsâ understandings of democracy, and how the displacement of content can be important in formulating compelling questions and in designing inquiries on democracy
The impact of uncertainty on optimal emission policies
We apply a computational framework for specifying and solving sequential decision problems to study the impact of three kinds of uncertainties on optimal emission policies in a stylized sequential emission problem.We find that uncertainties about the implementability of decisions on emission reductions (or increases) have a greater impact on optimal policies than uncertainties about the availability of effective emission reduction technologies and uncertainties about the implications of trespassing critical cumulated emission thresholds. The results show that uncertainties about the implementability of decisions on emission reductions (or increases) call for more precautionary policies. In other words, delaying emission reductions to the point in time when effective technologies will become available is suboptimal when these uncertainties are accounted for rigorously. By contrast, uncertainties about the implications of exceeding critical cumulated emission thresholds tend to make early emission reductions less rewarding
Naisdivinaattorien pyydyksissĂ€? : Katsaus Hesekielin kirjan jakeiden 13:17â23 taustalla mahdollisesti vaikuttaviin ilmiöihin
Tarkastelen tĂ€ssĂ€ pro gradu -tutkielmassa Hesekielin kirjan jakeiden 13:17â23 sisĂ€ltĂ€mÀÀn kuvaukseen mahdollisesti vaikuttaneita uskonnollisia ilmiöitĂ€. NĂ€mĂ€ jakeet sisĂ€ltĂ€vĂ€t pelkĂ€stÀÀn naisista koostuvalle ryhmĂ€lle suunnatun tuomion, jossa kiintoisasti viitataan sekĂ€ profetiaan ettĂ€ erikoisilla vĂ€lineillĂ€ tapahtuvaan sielujen pyydystĂ€miseen. TĂ€stĂ€ syystĂ€ jakeita koskeva tutkimus on jakaantunut useampaan eri suuntaan. Osa tutkijoista on katsonut, ettĂ€ jakeiden takaa on mahdollista löytÀÀ ryhmĂ€, joka olisi harjoittanut esimerkiksi noituutta, parantamista tai kuolleiden henkien kautta tapahtuvaa divinaatiota eli nekromantiaa. Toisaalta osa tutkijoista on tuonut esille, ettĂ€ jakeet peittĂ€vĂ€t poleemisella kuvauksellaan ryhmĂ€n todellista toimintaa, mikĂ€ estÀÀ tuomion kohteena olleen ryhmĂ€n löytĂ€misen. Tutkielma pyrkii selvittĂ€mÀÀn, mikĂ€ olisi todennĂ€köisin ja parhaiten perusteltavissa ratkaisu kuvauksen erikoisilta vaikuttaville piirteille.
Metodologisesti pro gradu -tutkielmaa voidaan pitÀÀ uskonnonhistoriallisena tutkimuksena, jossa kiinnitetÀÀn huomiota vertailevaan menetelmÀÀn ja tekstien mahdolliseen ideologisuuteen. Olennaista tutkielmassa on erilaisten Vanhan testamentin ja muinaisen LÀhi-idÀn uskonnollisten ilmiöiden tarkastelu. TÀmÀn lisÀksi tarkastelen Hesekielin kirjaa yleisesti tutkimuskysymyksen kannalta keskeisistÀ nÀkökulmista.
Tutkielman kolmannessa luvussa kĂ€sittelen jakeiden 13:17â23 rakennetta ja sanastoa. Jakeet ovat analyysin perusteella hyvin monitulkintaiset. Toisaalta niissĂ€ kĂ€ytetÀÀn naisryhmĂ€stĂ€ profetiaan mahdollisesti viittaavaa verbiĂ€ mutta myös pyydystĂ€miseen liittyvÀÀ kuvastoa. PyydystĂ€misessĂ€ kĂ€ytetyt vĂ€lineet jÀÀvĂ€t jakeiden perusteella moniselitteisiksi. Tulkinnanvaraista on myös se, pyydystĂ€vĂ€tkö naiset vertauskuvallisesti ihmisiĂ€ vai heidĂ€n sielujaan. Moniselitteisyys luonnollisesti johtaa erilaisiin painotuksiin, mikĂ€ nĂ€kyy lukuisissa jakeita kĂ€sittelevissĂ€ tutkimuksissa. Analyysi ja taustoitus toimivat pohjana eri tutkimuksissa tehtyjen ratkaisujen arvioinnille.
Taustoituksen ja analyysin valossa tehty eri tutkimuksien arviointi mielestÀni osoittaa, ettÀ jakeiden tuomion kieli selittyy parhaiten sillÀ, ettÀ kirjoittaja on hyödyntÀnyt kÀsityksiÀ vaarallisista naisista tai noidista. Sen sijaan jakeiden kuvaus ei suoraan vaikuta vastaavan kuvaa, joka esimerkiksi parantamisesta tai nekromantiasta on eri lÀhteiden perusteella mahdollista saada. NÀin ollen naisista voidaan kohtalaisella varmuudella sanoa ainoastaan, ettÀ he olivat naispuolisia divinaation harjoittajia, jotka eivÀt sopineet kirjoittajan tavoittelemaan uskonnolliseen jÀrjestykseen
Extensional equality preservation and verified generic programming
In verified generic programming, one cannot exploit the structure of concrete
data types but has to rely on well chosen sets of specifications or abstract
data types (ADTs). Functors and monads are at the core of many applications of
functional programming. This raises the question of what useful ADTs for
verified functors and monads could look like. The functorial map of many
important monads preserves extensional equality. For instance, if are extensionally equal, that is, , then and are also
extensionally equal. This suggests that preservation of extensional equality
could be a useful principle in verified generic programming. We explore this
possibility with a minimalist approach: we deal with (the lack of) extensional
equality in Martin-L\"of's intensional type theories without extending the
theories or using full-fledged setoids. Perhaps surprisingly, this minimal
approach turns out to be extremely useful. It allows one to derive simple
generic proofs of monadic laws but also verified, generic results in dynamical
systems and control theory. In turn, these results avoid tedious code
duplication and ad-hoc proofs. Thus, our work is a contribution towards
pragmatic, verified generic programming.Comment: Manuscript ID: JFP-2020-003
Generic programming with C++ concepts and Haskell type classesâa comparison
Earlier studies have introduced a list of high-level evaluation criteria to assess how well a language supports generic programming. Languages that meet all criteria include Haskell, because of its type classes, and C++ with the concept feature. We refine these criteria into a taxonomy that captures commonalities and differences between type classes in Haskell and concepts in C++, and discuss which differences are incidental and which ones are due to other language features.
The taxonomy allows for an improved understanding of language support for generic programming, and the comparison is useful for the ongoing discussions among language designers and users of both languages
Types, equations, dimensions and the Pi theorem
The languages of mathematical physics and modelling are endowed with a rich
"grammar of dimensions" that common abstractions of programming languages fail
to represent. We propose a dependently typed domain-specific language (embedded
in Idris) that captures this grammar. We apply it to explain basic notions of
dimensional analysis and Buckingham's Pi theorem. We hope that the language
makes mathematical physics more accessible to computer scientists and
functional programming more palatable to modelers and physicists.Comment: Submitted for publication in the "Journal of Functional Programming"
in August 202
- âŠ